<html>
<head>
	<title> Launch Page </title>
	
    <script>
    
        var s;
    
        function log(data){
            document.getElementById("output").innerHTML+=data+"<br>";}
    
        window.onload = function() {
      
            log("Initializing console ...");
            
            s = new WebSocket("ws://localhost:8787/test","sample");
            s.onopen = function(e) { log("Connection opened!"); }
            s.onclose = function(e) {log("Conection closed!"); }
            s.onmessage = function(e) { log("Recieving: "+e.data); }
      };
      
      function submit(){
      
        input_box=document.getElementById("input");
        log("Transmitting: "+input_box.value);
        s.send(input_box.value)
      }
    </script>
	
</head>

<body>
	<h1> Websockets echo server test </h1>
    
    <p id="output" style="width:800px; height:400px; background-color:#d0e4fe; font-family:sans-serif"></p>
        
    <input type="text" id="input" style="width:600px">
    <input type="button" onclick="submit()" value="ACKNOWLEDGE//SUBMIT">
	
</body>
</html>